package com.project_doctor.mapper;

import com.project_doctor.pojo.PersonalProfile;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;

@Mapper
/**
* @author 龙龙与贝儿
* @description 针对表【t_personal_profile】的数据库操作Mapper
* @createDate 2025-05-29 19:33:32
* @Entity com.project_doctor.pojo.PersonalProfile
*/
public interface PersonalProfileMapper extends BaseMapper<PersonalProfile> {
    @Select("SELECT p.*,r.id AS role_id, r.role_name AS role_name " +
            "FROM t_personal_profile p " +
            "LEFT JOIN t_role r ON p.doctor_role_id = r.id " +
            "WHERE p.id = #{doctorId}")
    @Results({
            @Result(property = "doctorRoleId", column = "doctor_role_id"), // 添加这个映射
            @Result(property = "role.id", column = "role_id"),
            @Result(property = "role.roleName", column = "role_name")
    })
    PersonalProfile selectUserByIdWithRole(@Param("doctorId") Long doctorId);
}




